/**
 * Response class. Handles networkinfo request reponse.
 * 
 * @class NG.response.NetworkInfo
 * @extends NG.response.Response
 */
NG.response.NetworkInfo = Ext.extend(NG.response.Response, {

	/**
	 * @field {NG.models.NetworkInfo}
	 */
	networkInfo:null,

	constructor: function(config){
		NG.response.NetworkInfo.superclass.constructor.call(this, config);
	},
	
	init: function (xmlData) {
		NG.response.NetworkInfo.superclass.init.call(this, xmlData);
		var xmlStr = fleegix.xml.parse(fleegix.xml.createDoc(xmlData), 'string').string;
		var xmlDoc = fleegix.xml.createDoc(xmlStr);
				
		//TODO birden Network varsa ??
		var network = {
			networkName: fleegix.xml.parse(xmlDoc, 'NetworkName').NetworkName,
			displayName: fleegix.xml.parse(xmlDoc, 'DisplayName').DisplayName,
			shortestPath: fleegix.xml.parse(xmlDoc, 'ShortestPath').ShortestPath,
			analysis: fleegix.xml.parse(xmlDoc, 'Analysis').Analysis
		};

		var networkInfo = Ext.ModelMgr.create({}, 'NG.models.NetworkInfo');
		networkInfo.setNetwork(network);
		this.networkInfo = networkInfo;
		
		//UseableRoadKinds - Road
		var roadArray = fleegix.xml.parse(xmlDoc, "Road").Road;
		networkInfo.setUseableRoadKinds(roadArray);
	},
	
	/**
	 * 
	 * @return {NG.models.NetworkInfo}
	 */
	getNetworkInfo: function(){
		return this.networkInfo;
	}
	
});